﻿function MenuBarClick() {

    if ($(document.body).hasClass("site-menubar-unfold")) {//不折叠
      
        $('#menu li.site-menu-item.has-sub.first').removeClass("open");
        $('#menu li.site-menu-item.has-sub.second').removeClass("open");
        $('#menu li.site-menu-item.first  span.glyphicon.glyphicon-menu-right').show();
        $(document.body).removeClass("site-menubar-unfold").addClass("site-menubar-fold");


    } else if ($(document.body).hasClass("site-menubar-fold")) {
     
        $('#menu li.site-menu-item.first  span.glyphicon.glyphicon-menu-right').hide();
        $(document.body).removeClass("site-menubar-fold").addClass("site-menubar-unfold");

    }
  
    $('.main .big-left').toggleClass('small-left');
}



$(document).on("click", function (e) {
    //顶部自建功能(换色 头像)
    if (!$(e.target).closest(".animation-scale-up").length) {
        $("#admui-navbarDisplay").removeClass("open")
        $("#head_portrait_li").removeClass("open")
    }
}).on("click", "#admui-navbarDisplay,#head_portrait_li,#admui-navbarMessage", function (e) {
    if ($(e.target).closest(".animation-scale-up").length) {
        $(this).removeClass("open")
    } else {
        $(this).addClass("open")
    }
    e.stopPropagation()
}).on("click", ".wb-layout", function (e) {
    if ($("#admui-navbarDisplay").hasClass("open")) {
        $(".open").removeClass("open")
    } else {
        $(".open").removeClass("open")
        $("#admui-navbarDisplay").addClass("open")
    }
    e.stopPropagation()
}).on("click", "#nav_layout", function (e) {
    e.stopPropagation()
}).on("click", ".nav-change-color", function () {
    $(".site-navbar").css("background-color", $(this).children("a").css("background-color"));

}).on("mousemove", "#nav_layout", function () {
    $(this).parent().next("div").hide()
}).on("click", "#admui-navbarFullscreen", function (element) {
    //点击全屏
    var docElm = document.documentElement;
    if (document.body.scrollHeight == window.screen.height && document.body.scrollWidth == window.screen.width) {
        if (document.exitFullscreen) {
            document.exitFullscreen();
        }
        else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        }
        else if (document.webkitCancelFullScreen) {
            document.webkitCancelFullScreen();
        }
        else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        }
    } else {
        //W3C  
        if (docElm.requestFullscreen) {
            docElm.requestFullscreen();
        }
            //FireFox  
        else if (docElm.mozRequestFullScreen) {
            docElm.mozRequestFullScreen();
        }
            //Chrome等  
        else if (docElm.webkitRequestFullScreen) {
            docElm.webkitRequestFullScreen();
        }
            //IE11
        else if (elem.msRequestFullscreen) {
            elem.msRequestFullscreen();
        }
    }
})


 
//手机预览模块
$("#admui-QRcode").on("click", function () {
    var $layer = '<div class="modal-backdrop fade in" id="qrcode_layer"></div>'
    if (!$(document.body).hasClass("modal-open")) {
        $(document.body).addClass("modal-open").append($layer).find($("#admui-mobileView").addClass("in").css("display", "block"))
    }
})
$("#admui-mobileView").on("click", function () {
    $(document.body).removeClass("modal-open").find($("#admui-mobileView").removeClass("in").css("display", "none"))
    $("#qrcode_layer").remove();
})





//全选
$(document).on("click", ".AllClickCheckbox", function () {
    if (this.checked) {
        $(".AllClickChild").prop("checked", true);
    } else {
        $(".AllClickChild").prop("checked", false);
    }
})